// import Vuex from 'vuex'
// Vue.use(Vuex)

const module = {
  state: {
    list: {
      postion: 0,
      status: 0,
      pageNo: 0,
      reffer: 0,
    },
    arriAddr: {
      province: '',
      city: '',
      district: '',
      address: '',
      contact: '',
      contactno: ''
    },
    customer: {},
    sellforms: [],
    acts: {
      'clientUpdate':  'CustomerEdit',
      'priceAdjust':  'ChangePrice',
      'dispatch':  'SellDispatch', //销售单调度
      'salesOut':  'OutStoreRoom',
      'pickinglistOut':  'OutStoreRm', //领料单
      'materialOut':  'OutStoreRoom', //销售订单
      'scrapOut':  'ScrapOutStoreRm', //报废单
      'transferOut':  'TransferOutStoreRm', //库房调拨出库
      'transferIn':  'TransferFeedStoreRm', //库房调拨入库
      'transAdjust':  'EditLine',
      'settleConfirm':  'SellFinalSure',  //销售订单结算确认
      'fareConfirm':  'ConfirmFare',
      'qacheck4sc': 'Examine',
      'approval2':  'CommonExamine', //销售订单
      'finance2':  'Finance2', //销售订单
      'approvalBack':  'ApprovalBack', //销售订单
      'whoutBack2':  'WhoutBack', //销售订单退库
      'settleBack2':  'SettleBack', //销售订单
      'delete2':  'Delete2', //销售订单删除
      'partition':  'DivideOrder', //销售订单拆分
      'partition2':  'DivideOrder', //销售订单拆分
      // 'approval2':  'EditSellform', //销售订单
      'approval4': 'Examine', //报废单
      'approval5': 'Examine5', //入库申请单
      'approval6': 'Examine6', //领料单
      'approval7': 'Examine7', //库房调拨
      'back7': 'BackWhinfo7', //库房调拨
      'finance7': 'Finance7', //库房调拨
      'delete7': 'Delete7', //库房调拨删除
      'whoutapp7': 'Examine7', //库房调拨退回入库库房
      'whoutBack7': 'WhoutBack7', //库房调拨反出库
      'whinBack7': 'WhinBack7', //库房调拨反入库
      'approval8': 'Examine7', //库房调拨
      'financial8': 'Finance8', //库存调整
      'financial9': 'Finance8', //库存调整
      'approval9': 'Examine7', //库房调拨
      'approval10': 'Examine10', //销售客户充值
      'ChargeIn': 'RechargeFinaExamine', //销售客户充值财务审批
      'approval13': 'Examine13', //采收合同价格调整
      'confirm': 'ConfirmChangeContractPrice', //采收合同价格调整
      'materialIn': 'FeedStoreRm',
      'whinapply': 'ApplyStoreRm',
      'materapply': 'AddMaterialRetApply',
      'scrapapply': 'ApplyScrap',
      'bigOrder': 'DispatchCustomer', //大订单派单
      'orderMatch': 'PaybackDetail', //回款登记调度审批
      'approval15': 'DelPayback', //回款登记删除
      'finConfirm': 'PaybackExamine', //回款登记财务审批
      'approval16': 'Examine16', //物流结算
      'unConfirm': 'unConfirm16', //物流反结算
      'sendSea': 'Book', //物流结算
      'deletePayback': 'DelPayback', //回款登记删除
      'arrivalConfirm': 'ArrivalConfirm', //物流到货确认
      'confirmFreight': 'ConfirmPassport', //运费确认
      'shareCar': 'ShareCar', //物流拼车
      'fareAudit': 'PassportExamine', //运费结算主管审批
      'payConfirm': 'PassportPayConfirm', //运费结算付款确认
      'payBack': 'SellPayBack', //销售订单回款登记
      'sendCar7': 'reSendCar', //调拨派车
      'start': 'EditSellform', //调拨派车
      'approval17': 'Examine17', //退换货审批
      'withdraw': 'AddBackinfo', //销售单退换货
      'approval18': 'Examine18', //退换货审批
      'approval19': 'Examine19', //采收账单审批
      'finance19': 'Finance19', //采收账单审批
      'pay19': 'ForderList', //采收账单支付
      'del19': 'Del19', //采收账单删除
      'finalPay19': 'FinalPay19', //采收账单删除
      'edit18': 'EditProContract', //采收合同修改
      'editPrice': 'AddChangeContractPrice', //采收合同调价
      'transferOut22':  'PlantTransOutStoreRm', //种植服务出库
      'transferIn21':  'PlantTransFeedStoreRm', //种植服务入库
      'approval23': 'Examine23', //采购订单
      'approval26': 'Examine26', //采购订单
      'transferIn26': 'FeedStoreRm26', //采购订单
      'backOut26': 'WhinBack26', //采购订单
      'whinback23': 'WhinBack23', //采购订单
      'transferIn23': 'PurchaseFeedStoreRm', //采购订单
      'approval24': 'Examine24', //采收订单
      'outBack24': 'OutBack24', //采收订单
      'del24': 'Delete24', //采收订单
      'weigh': 'Weigh', //采收订单
      'accept': 'Accept', //采收订单
      'whinBack24': 'whinBack24', //采收订单
      'whin': 'Whin', //采收订单
      'approval99': 'Examine99', //采购订单测试
      'whinback99': 'WhinBack99', //采购订单测试
      'transferIn99': 'PurTestFeedStoreRm', //采购订单测试
      'approval14': 'Examine14', //运费支付申请
      'pay14': 'Pay14', //运费支付申请
      'del14': 'Delete14', //运费支付申请
      'approval25': 'Examine25', //采收定价申请
      'approval28': 'Examine28', //新库房调拨
      'finance28': 'Finance28', //新库房调拨
      'sendcar28': 'SendCar28', //新库房调拨
      'transferOut28': 'TransferOut28', //新库房调拨
      'whoutapp28': 'Examine28', //新库房调拨
      'whoutBack28': 'WhoutBack28', //新库房调拨
      'transferIn28': 'TransferIn28', //新库房调拨
      'whinBack28': 'WhinBack28', //新库房调拨
      'approval27': 'Examine27', //新其他出入库
      'financial27': 'Finance27', //新其他出入库
      'sendcar27': 'SendCar27', //新其他出入库
      'transferOut27': 'TransferOut27', //新其他出入库
      'whoutapp27': 'Examine27', //新其他出入库
      'whoutBack27': 'WhoutBack27', //新其他出入库
      'transferIn27': 'TransferIn27', //新其他出入库
      'whinBack27': 'WhinBack27', //新其他出入库
      'approval29': 'Examine29', //新客户管理
      'confirm29': 'Confirm29', //新客户管理
      'start29': 'EditCustomer2', //新客户管理
      'approval30': 'Examine30', //新生产领料
      'pickinglistOut30': 'OutStoreRm30', //新生产领料
      'approval33': 'Examine33', //新生产入库
      'whin33': 'FeedStoreRm33', //新生产入库
      'inStoreroom31': 'FeedStoreRm31', //新退料申请
      'approval34': 'Examine34', //电商订单
      'dispatch34': 'SplitOrder', //电商订单
      'salesWhout34': 'SellformOut', //电商订单
      'start34': 'EditSellform2', //电商订单
      'reverseWhout34': 'ReverseWhout34', //电商订单
      'approval35': 'Examine34', //样品订单
      'dispatch35': 'SplitOrder', //样品订单
      'salesWhout35': 'SellformOut', //样品订单
      'start35': 'EditSellform2', //样品订单
      'reverseWhout35': 'ReverseWhout34', //样品订单
      'approval36': 'Examine34', //销售订单
      'dispatch36': 'SplitOrder', //销售订单
      'salesWhout36': 'SellformOut', //销售订单
      'start36': 'EditSellform2', //销售订单
      'reverseWhout36': 'ReverseWhout34', //销售订单
      'sendcar36': 'SendCar34', //销售订单
      'settleConfirm36': 'SellFinalSure36', //销售订单
      'finConfirm36': 'FinalConfirm36', //销售订单
      'approval37': 'Examine37', //客户充值
      'chargeIn37': 'ChargeIn', //客户充值
      'approval38': 'Examine38', //运费支付
      'pay38': 'Pay38', //运费支付
      'approval39': 'Examine39', //采收合同
      'approval40': 'Examine40', //采收订单
      'weight40': 'Weigh40', //采收订单
      'reverseWhin40': 'Whinback40', //采收订单
      'whin40': 'Whin40', //采收订单
      'confirm40': 'Confirm40', //采收订单
      'qaCheck40': 'Qacheck40', //采收订单
      'approval41': 'Examine41', //采收支付申请
      'finance41': 'Finance41', //采收支付申请
      'pay41': 'Pay41', //采收支付申请
      'finalPay41': 'FinalPay41', //采收支付申请

    },
    optlogRemarks: [],
    permissions: []
  },
  getters: {},
  mutations: {
    setPosition(state, payload){
      state.list.postion = payload
    },
    setReffer(state, payload){
      state.list.reffer = payload
    },
    setStatus(state, payload){
      state.list.status = payload
    },
    setPageNo(state, payload){
      state.list.pageNo = payload
    },
    setCustomer(state, payload){
      state.customer = payload;
      // state.customer.guid = payload.guid;
      // state.customer.name = payload.name;
      // state.customer.rcamount = payload.recbalance;
    },
    setArriAddr(state, payload){
      state.arriAddr.province = payload.province;
      state.arriAddr.city = payload.city;
      state.arriAddr.district = payload.district;
      state.arriAddr.address = payload.address;
      state.arriAddr.contact = payload.contact;
      state.arriAddr.contactno = payload.contactno;
    },
    setSellforms(state, payload){
      state.sellforms = payload;
    },
    pushOlogRemark(state, payload){
      state.optlogRemarks.push(payload);
    },
    pullOlogRemark(state, payload){
      state.optlogRemarks = state.optlogRemarks.filter(item => {
        return item != payload;
      });
    },
    setPermissions(state, payload){
      state.permissions = payload;
    }
  },
}


const store = new Vuex.Store(module)
export default store
